What is Parameter Pack
-
A template parameter pack is a template parameter that accepts 0 or more template arguments.
A function parameter pack is a function parameter that accepts zero or more function arguments.
Parameter Pack with Left Fold Expression
-
Left Fold Expression?
template <class ... T>
void f1(T ... val) {
(cout << ... << val); //Expanded to cout << arg1 << arg2 ..
}
int main(){
f1('a'); //Expanded as f1 <char> () //output = a
f1(2," cd "); //f1 <char, int, char const*> ()//output = 2 cd
}